<extend name="Public:template" />
<block name="page_header">
	<ul class="header-sub">
		<li class="previous"><a href="#" class="btn btn-default active" role="button" onClick="javascript:window.history.back(-1);return false;"><span class="icon icon-chevron-left"></span>返回</a></li>
		<li ><h3>商品详细</h3></li>
		<li class="next "><a href="{:U('Cust/index')}" class="btn btn-warning active" role="button">我的<span class="icon-white icon-user"></span></a></li>
	</ul>
</block>
<block name="page_body">
<div class="media mt15">
	<a class="pull-left" href="#">
 			<img src="{$detail.prod_pic}" width="130" class="media-object img-thumbnail">
	</a>
	<div class="media-body">
		<h4 class="media-heading">{$detail.title}</h4>
		<p>
			<span class="label label-info mt5">{$detail.prod_spec}</span>
			<p class="price mt15">
				<span class="now">¥{$detail.price_real}</span>
				<span class="old">¥{$detail.price_sale}</span>
				<if condition="$detail['is_show'] eq 0"><span class="label label-danger">该商品已下架</span></if>
			</p>
		<p>
	</div>
</div>
<form action="{:U('Tuangou/showConfirm')}" method="get" id="form_add" name="form_add" role="form">
<input type="hidden" name="prod_id" value="{$detail.prod_id}">
<div class="row">
	<div class="col-xs-5 col-sm-5">
		<div class="input-group">
			<span class="input-group-btn">
				<button type="button"  class="btn btn-default active input-sm " onclick="addNum('-1')" >-</button>
			</span>
			<input type="number" class="form-control input-sm" style="padding:5px 0;text-align:center;border:1px solid #cccccc;" id="prodNum" name="num" value="1"/>
			<span class="input-group-btn">
				<button type="button"  class="btn btn-default active input-sm " onclick="addNum('1')" >+</button>
			</span>
			
		</div>

	</div>
	<div  class="col-xs-1 col-sm-1"></div>
	<div class="col-xs-6 col-sm-6">
		<button type="submit" class="btn btn-warning btn-block btn-sm"><span class="icon-white icon-shopping-cart"></span>立即预订</button>
	</div>
</div>
</form>
<div class="row mt5">
	<div class="col-xs-12 col-sm-12">
		<div class="list-group">
			<div class="list-group-item " >
				<h4 class="list-group-item-heading">商品详细</h4>
				<hr class="mt5">
				<div id="prod_content"></div>
				<hr class="mt5">
				<div>预购区商品配送说明：为了保证商品的新鲜质量，我们每周五统一配送一次，如果您对时间有特殊要求，请联系我们的客服，客服电话在最下方</div>
			</div>
		</div>
	</div>
</div>

<!-- 商品列表页面  -->
</block>
<block name="script_footer">
<script type="text/javascript">
loadDetail();
function loadDetail(){
	var prod_id = "{$detail.prod_id}";
	//问题 直接在底部不加载数据了
	//document.location.href = "/cart/doadd.html?prod_id="+prod_id+"&num="+num+"&edittype="+edittype;
	$.ajax({
        'url': "/Tuangou/showContent",
        'dataType': "json",
        'data': {'prod_id':prod_id},
        'success': function (data) {
        	if(data['error']=='0'){
            	$("#prod_content").html(data['content']);
        	}else{
        		alert(data['message']);
        	}
        }
    });
}
function addNum(num){
	var cur = parseInt($('#prodNum').val());
	var total = cur + parseInt(num);
	if(total <= 0){
		total = 1;
	}
	$('#prodNum').val(total);
	
}
</script>
</block>